Confidence-based static analysis

ABSTRACT

Systems, methods and program products are provided for confidence-based static analysis, including initiating a static analysis of computer software, associating a confidence value with a first element of the static analysis, determining a current state of the static analysis, calculating an adjusted confidence value in accordance with a confidence adjustment function as applied to the current state and the confidence value associated with the first element, associating the adjusted confidence value with a second element of the static analysis resulting from a transition from the first element, and eliminating the second element from the static analysis if the adjusted confidence value meets elimination criteria.

BACKGROUND

Static analysis of computer software applications typically involves adegree of uncertainty. For example, where a function relies on the valueof a variable to determine which of several other functions to call, andthe value of the variable may only be known at run-time, static analysiscannot determine which function will be called. However, sound staticanalysis typically requires consideration of each of the potential pathsfrom the calling function. When analyzing a large, complex application,a sound static analysis may end up tracking a large number of infeasibleflows due to conservative control-flow judgments, the result beinghighly imprecise and leading to a high rate of false-positive reports.

SUMMARY

In one aspect of the invention a method, system and computer programproduct is provided for confidence-based static analysis to initiate astatic analysis of computer software, associate a confidence value witha first element of the static analysis, determine a current state of thestatic analysis, calculate an adjusted confidence value in accordancewith a confidence adjustment function as applied to the current stateand the confidence value associated with the first element, associatethe adjusted confidence value with a second element of the staticanalysis resulting from a transition from the first element, andeliminate the second element from the static analysis if the adjustedconfidence value meets elimination criteria.

BRIEF DESCRIPTION OF THE DRAWINGS

So that the manner in which the above recited aspects are attained andcan be understood in detail, a more particular description ofembodiments of the invention, briefly summarized above, may be had byreference to the appended drawings.

It is to be noted, however, that the appended drawings illustrate onlytypical embodiments of this invention and are, therefore, not to beconsidered limiting of its scope, for the invention may admit to otherequally effective embodiments.

FIG. 1 is a simplified conceptual illustration of a system forconfidence-based static analysis, constructed and operative inaccordance with an embodiment of the invention;

FIG. 2 is a simplified flowchart illustration of an exemplary method ofoperation of the system of FIG. 1, operative in accordance with anembodiment of the invention;

FIG. 3 is a simplified pseudo-code example of an implementation of themethod of FIG. 2, operative in accordance with an embodiment of theinvention;

FIG. 4 is a simplified source-code example of an implementation of themethod of FIG. 2, operative in accordance with an embodiment of theinvention; and

FIG. 5 is a simplified block diagram illustration of an exemplaryhardware implementation of a computing system, constructed and operativein accordance with an embodiment of the invention.

DETAILED DESCRIPTION

The invention is now described within the context of one or moreembodiments, although the description is intended to be illustrative ofthe invention as a whole, and is not to be construed as limiting theinvention to the embodiments shown. It is appreciated that variousmodifications may occur to those skilled in the art that, while notspecifically shown herein, are nevertheless within the true spirit andscope of the invention.

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical datastorage device, a magnetic data storage device, or any suitablecombination of the foregoing. In the context of this document, acomputer readable storage medium may be any tangible medium that cancontain, or store a program for use by or in connection with aninstruction execution system, apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

Reference is now made to FIG. 1 which is a simplified conceptualillustration of a system for confidence-based static analysis,constructed and operative in accordance with an embodiment of theinvention. In the system of FIG. 1, a static analyzer 100 is configuredto statically analyze computer software (e.g., a computer softwareapplication), such as by analyzing the application source code orbytecode, to identify potential vulnerabilities within the application.In tracking one or more elements in a given domain, static analyzer 100associates a starting confidence value with each seed element of theanalysis, such as a value of 100.

An analysis state determiner 102 is configured to determine a currentstate of the static analysis, such as when performing a transitionduring the analysis that results in a modification of the analysis'abstract representation of the application. Analysis state determiner102 may determine the current state of the static analysis using anymethod, such as by consulting a static analysis history 104 that ismaintained of all the information computed and observed up to thepresent point in the analysis.

A confidence level adjustor 106 is configured to calculate an adjustedconfidence value based on a confidence value of a tracked element, suchas when static analyzer 100 reaches a transition point within theapplication. Confidence level adjustor 106 may calculate the adjustedconfidence value by increasing the confidence value of the trackedelement, decreasing it, or making no adjustment to it, all in accordancewith confidence adjustment function 108 as applied to the current stateof the static analysis. Confidence level adjustor 106 preferably setsthe confidence value of each element resulting from the transition equalto the adjusted confidence value.

An element tracking eliminator 110 is configured to determine whether ornot static analyzer 100 should continue tracking an element by applyingelimination criteria 112 to the current confidence level of an element.If the confidence value of an element meets elimination criteria 112,such as where the confidence value is zero or below a given value, theelement is not tracked further during the analysis.

Static analyzer 100 preferably presents the results of the staticanalysis via a computer-controlled output medium, such as a computerdisplay or printout. Any item of the static analysis results may bepresented along with a representation of any of the confidence values ofany of the domain elements relating to the result, such as an average ofthe confidence values of the elements, or the lowest confidence value ofany of the elements.

Any of the elements shown in FIG. 1 are preferably executed by orotherwise made accessible to a computer 114, such as by implementing anyof the elements in computer hardware and/or in computer softwareembodied in a physically-tangible, computer-readable medium inaccordance with conventional techniques.

Reference is now made to FIG. 2 which is a simplified flowchartillustration of an exemplary method of operation of the system of FIG.1, operative in accordance with an embodiment of the invention. In themethod of FIG. 2, static analysis of a computer software application isinitiated to track one or more elements in a given domain (step 200). Astarting confidence value is associated with each seed element of theanalysis, such as a value of 100 (step 202). The current state of theanalysis is determined (step 204), such as when performing a transitionduring the analysis that results in a modification of the analysis'abstract representation of the application, and such as by consulting ahistory that is maintained of all the information computed and observedup to the present point in the analysis. An adjusted confidence value iscalculated based on a confidence value of a tracked element (step 206),such as when a transition point is within the application. The adjustedconfidence value may be calculated by increasing the confidence value ofthe tracked element, decreasing it, or making no adjustment to it, allin accordance with the confidence adjustment function as applied to thecurrent state of the static analysis. The confidence value of eachelement resulting from the transition is set equal to the adjustedconfidence value (step 208). If the confidence value of a domain elementmeets elimination criteria, such as where the confidence value is zeroor below a given value, the domain element is not tracked further duringthe analysis (step 210).

The method of FIG. 2 may be understood by way of example, such as whereit is known that static analysis of an application of a certain sizewill produce analysis results indicating a certain number of securityvulnerabilities on average. When performing a transition during theanalysis, the number of security vulnerabilities discovered thus far ischecked, and if the number of discovered security vulnerabilitiesexceeds the expected number of discovered security vulnerabilities, theapplicable confidence function may dictate that the confidence values ofthe resulting domain elements be decreased by a given value. In anotherexample, when performing a transition from a virtual call site to acallee method, an associated call graph is consulted to determine howmany resolutions there are for the call site. If the number ofresolutions is high, then there is likely imprecision in thedisambiguation of the call site, which should be reflected in theconfidence value associated with the resulting domain elements, in whichcase the applicable confidence function may likewise dictate that theconfidence values of the resulting domain elements be decreased.

According to one embodiment, the method of FIG. 2 may also be understoodby way of a simplified pseudo-code example shown in FIG. 3, where‘AnalysisArtifact’ represents an element that is tracked in a givendomain. In the example of FIG. 3, information other than what is in aparticular statement may be used to adjust a confidence level. Forexample, if the statement is a call site, then the confidence level maybe adjusted based on how many resolutions there are for the call site inthe program's call graph. Optionally, analysis artifacts that differonly in terms of confidence level may be merged, so as to track fewerartifacts. This is shown by the ‘foreach’ statement.

According to one embodiment, the method of FIG. 2 may also be understoodby way of a simplified source-code example shown in FIG. 4. In theexample shown, there may be a vulnerable flow from source to sink if aninstance of BankDetailsImpl4 is returned through the call togetBankDetails. This is because this subclass of BankDetails overridesvirtual method getAccountID, and explicitly uses the ‘name’ parameter inits result, as opposed to BankDetails.getAccountID, which simply maps‘name’ to its corresponding account ID, which is not controlled by theattacker. By applying the method of FIG. 2, a confidence value, such as10, is associated with ‘name’. In the example, when a virtual call isencountered the confidence value decreases proportionate to the numberof resolutions of the call, where each resolution has “weight” of 2.Thus, since there are 4 resolutions to the call shown, the decrease is(4−1)*2=6, resulting in the following confidence values for ‘name’ and‘accountID’:

name <−> 10 accountID <−> 10 − 6 = 4

Thus, the overall flow has a relatively low confidence value of 4,which, in the example shown, reflects the certainty that the valuereaching the sink was indeed tainted.

The analysis may be configured to make the following choices based onthe above information:

-   -   1. It can use this information to assign a low priority to the        source-to-sink flow.    -   2. It can stop tracking variable ‘accountID’ if its confidence        value is below a predefined threshold value below which tainted        variables are not traced.    -   3. It can continue tracking ‘accountID’, but ultimately decide        to eliminate the flow from any report on the analysis results.        For example, the analysis may define the confidence level        associated with a flow as being the average of those associated        with the source and the sink (which is 7 in the example shown),        and use a special threshold value to determine whether flows        should be eliminated.

Referring now to FIG. 5, block diagram 500 illustrates an exemplaryhardware implementation of a computing system in accordance with whichone or more components/methodologies of the invention (e.g.,components/methodologies described in the context of FIGS. 1-2) may beimplemented, according to an embodiment of the invention.

As shown, the techniques for controlling access to at least one resourcemay be implemented in accordance with a processor 510, a memory 512, I/Odevices 514, and a network interface 516, coupled via a computer bus 518or alternate connection arrangement.

It is to be appreciated that the term “processor” as used herein isintended to include any processing device, such as, for example, onethat includes a CPU (central processing unit) and/or other processingcircuitry. It is also to be understood that the term “processor” mayrefer to more than one processing device and that various elementsassociated with a processing device may be shared by other processingdevices.

The term “memory” as used herein is intended to include memoryassociated with a processor or CPU, such as, for example, RAM, ROM, afixed memory device (e.g., hard drive), a removable memory device (e.g.,diskette), flash memory, etc. Such memory may be considered a computerreadable storage medium.

In addition, the phrase “input/output devices” or “I/O devices” as usedherein is intended to include, for example, one or more input devices(e.g., keyboard, mouse, scanner, etc.) for entering data to theprocessing unit, and/or one or more output devices (e.g., speaker,display, printer, etc.) for presenting results associated with theprocessing unit.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

It will be appreciated that any of the elements described hereinabovemay be implemented as a computer program product embodied in acomputer-readable medium, such as in the form of computer programinstructions stored on magnetic or optical storage media or embeddedwithin computer hardware, and may be executed by or otherwise accessibleto a computer (not shown).

While the methods and apparatus herein may or may not have beendescribed with reference to specific computer hardware or software, itis appreciated that the methods and apparatus described herein may bereadily implemented in computer hardware or software using conventionaltechniques.

While the invention has been described with reference to one or morespecific embodiments, the description is intended to be illustrative ofthe invention as a whole and is not to be construed as limiting theinvention to the embodiments shown. It is appreciated that variousmodifications may occur to those skilled in the art that, while notspecifically shown herein, are nevertheless within the true spirit andscope of the invention.

1. A method, comprising: initiating a static analysis of computersoftware; associating a confidence value with a first element of saidstatic analysis; determining a current state of said static analysis;calculating, by operation of one or more computer processors, anadjusted confidence value in accordance with a confidence adjustmentfunction as applied to said current state and said confidence valueassociated with said first element; associating said adjusted confidencevalue with a second element of said static analysis resulting from atransition from said first element; and eliminating said second elementfrom said static analysis if said adjusted confidence value meetselimination criteria.
 2. The method according to claim 1 wherein saiddetermining comprises determining said current state when performing atransition during said static analysis that results in a modification ofan abstract representation of said computer software.
 3. The methodaccording to claim 1 wherein said determining comprises determining saidcurrent state by consulting a history of information computed andobserved during said static analysis.
 4. The method according to claim 1wherein said eliminating comprises eliminating said second element fromsaid static analysis if said adjusted confidence value is less than orequal to a predefined elimination value.
 5. The method according toclaim 1, further comprising presenting a result of said static analysisvia a computer-controlled output medium along with a representation ofany of said confidence values of any of said elements relating to saidresult.
 6. The method according to claim 5, wherein said presentingcomprises presenting said representation as an average of saidconfidence values.
 7. The method according to claim 5, wherein saidpresenting comprises presenting said representation as the lowestconfidence value of any of said elements.
 8. A system, comprising: astatic analyzer configured to: initiate a static analysis of computersoftware, and associate a confidence value with a first element of saidstatic analysis; an analysis state determiner configured to determine acurrent state of said static analysis; a confidence level adjustorconfigured to: calculate an adjusted confidence value in accordance witha confidence adjustment function as applied to said current state andsaid confidence value associated with said first element, and associatesaid adjusted confidence value with a second element of said staticanalysis resulting from a transition from said first element; and anelement tracking eliminator configured to eliminate said second elementfrom said static analysis if said adjusted confidence value meetselimination criteria.
 9. The system according to claim 8 wherein saidanalysis state determiner is configured to determine said current statewhen performing a transition during said static analysis that results ina modification of an abstract representation of said computer software.10. The system according to claim 8 wherein said analysis statedeterminer is configured to determine said current state by consulting ahistory of information computed and observed during said staticanalysis.
 11. The system according to claim 8 wherein said elementtracking eliminator is configured to eliminate said second element fromsaid static analysis if said adjusted confidence value is less than orequal to a predefined elimination value.
 12. The system according toclaim 8 wherein said static analyzer is configured to present a resultof said static analysis via a computer-controlled output medium alongwith a representation of any of said confidence values of any of saidelements relating to said result.
 13. The system according to claim 12wherein said static analyzer is configured to present saidrepresentation as an average of said confidence values.
 14. The systemaccording to claim 12 wherein said static analyzer is configured topresent said representation as the lowest confidence value of any ofsaid elements.
 15. A computer program product for confidence-basedstatic analysis, the computer program product comprising: acomputer-readable storage medium; and computer-readable program codeembodied in said computer-readable storage medium, wherein saidcomputer-readable program code is configured to: initiate a staticanalysis of computer software, associate a confidence value with a firstelement of said static analysis, determine a current state of saidstatic analysis, calculate an adjusted confidence value in accordancewith a confidence adjustment function as applied to said current stateand said confidence value associated with said first element, associatesaid adjusted confidence value with a second element of said staticanalysis resulting from a transition from said first element, andeliminate said second element from said static analysis if said adjustedconfidence value meets elimination criteria.
 16. The computer programproduct according to claim 15 wherein said computer-readable programcode is configured to determine said current state when performing atransition during said static analysis that results in a modification ofan abstract representation of said computer software.
 17. The computerprogram product according to claim 15 wherein said computer-readableprogram code is configured to determine said current state by consultinga history of information computed and observed during said staticanalysis.
 18. The computer program product according to claim 15 whereinsaid computer-readable program code is configured to eliminate saidsecond element from said static analysis if said adjusted confidencevalue is less than or equal to a predefined elimination value.
 19. Thecomputer program product according to claim 15 wherein saidcomputer-readable program code is configured to present a result of saidstatic analysis via a computer-controlled output medium along with arepresentation of any of said confidence values of any of said elementsrelating to said result.
 20. The computer program product according toclaim 19 wherein said computer-readable program code is configured topresent said representation as an average of said confidence values. 21.The computer program product according to claim 19 wherein saidcomputer-readable program code is configured to present saidrepresentation as the lowest confidence value of any of said elements.